package com.hzw.saas.common.config.serializer.json;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * 序列化自动添加对象存储URL
 */
//@Component
public class ImgJsonSerializer extends JsonSerializer<String> {

//    @Autowired
//    private AliOSS aliOSS;
//
    @Override
    public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
//        if (StrUtil.isBlank(value)) {
//            gen.writeString(StrUtil.EMPTY);
//            return;
//        }
//        String[] imgs = value.split(StrUtil.COMMA);
//        StringBuilder sb = new StringBuilder();
//        for (String img : imgs) {
//            sb.append(aliOSS.getResourceUrl()).append(img).append(StrUtil.COMMA);
//        }
//        sb.deleteCharAt(sb.length()-1);
//        gen.writeString(sb.toString());
    }
}
